When you create new variform definitions, using the extends attribute to inherit the implementation of an existing form or table is an easy way of reusing and building on what is already there. The advantage of using extends versus copying the code that implements an existing form or table is that the extending variform changes whenever the extended variform changes.
When you extend an existing variform, everything defined in that variform gets included in the new variform. Unless you add new items or edit inherited items, the two variforms will look alike; only the variform ID will be different. If you add items to the new variform, they will appear at the end.
Extends works on various levels, meaning that you can extend a variform that extends another variform, and so on. For example, Table C can extend Table B, which extends Table A.
The following limitations exist:
You cannot extend two different variforms at the same time, that is Form C cannot extend Form B and Form A.
You cannot remove items inherited from the extended table.
You cannot extend tabs. If you extend a table that includes tabs, the variform definition must include the code that defines the tabs.
There is no easy way of editing an inherited item. If you do need to edit an inherited item, this requires that you copy the item code and edit it as part of the new variform.
In the following example, the second table extends the first table; it adds a new title and adds some additional attributes for a child table.
<table id="TABLE_SANDBOX_GOOS">
unit
<name>Goo</name>
</entity>
<crudCommand variformId="FORM_SANDBOX_GOO"/>
<attributes>
<attribute key="aVariformAttribute" value="aVariformAttributeValueFromTable"/>
</attributes>
<menu category="context">
<menuItem userActionId="EDIT_GOOS_SDC_FIELDS" label="Edit statically defined dynamic component"
variformId="SANDBOX_FORM_GOO_SDC_COMPONENTS" enable="oneSource"/>
</menu>
<column fieldId="gooName"/>
<column fieldId="gooActive"/>
<column fieldId="gooBoolean"/>
<column fieldId="gooBooleanNullable"/>
<column fieldId="gooStaticallyDefinedDynamicComponent.gooSDCUser"/>
<column fieldId="gooStaticallyDefinedDynamicComponent.gooSDCUser.buserUid"/>
<column fieldId="gooStaticallyDefinedDynamicComponent.gooSDCFoo.fooName"/>
<column fieldId="gooSynthetic" display="viewable" simpleQuery="always"/>
<column fieldId="gooOmitted" display="viewable" simpleQuery="omit"/>
<column fieldId="gooSyntheticDefault" display="viewable"/>
</table>
<!--For launching goos table from foo table's action menu-->
<table id="TABLE_SANDBOX_GOOS_FOR_FOO" extends="TABLE_SANDBOX_GOOS">
<title>Goos for Foo</title>
<attributes>
<attribute key="masterRefFieldId" value="gooFoo"/>
</attributes>
</table>